package com.hippy.erya.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 */
@Data
public class BaseDO implements Serializable {

    /**
     * 主键
     */
    @TableId(value = "id",type = IdType.AUTO)
    @ExcelIgnore
    private Long id;

    /**
     * 可用标识
     */
    @ExcelIgnore
    private int usableFlag;

    /**
     * 创建时间
     */
    @ExcelIgnore
    private Date createdAt;

    /**
     * 创建人
     */
    @ExcelIgnore
    private String createdBy;

    /**
     * 更新时间
     */
    @ExcelIgnore
    private Date updatedAt;

    /**
     * 更新人
     */
    @ExcelIgnore
    private String updatedBy;

    public BaseDO() {
        this.usableFlag = 1;
        this.createdAt = new Date();
        this.updatedAt = new Date();
    }

    public void deleteData(String updatedBy) {
        this.usableFlag = 0;
        this.updatedAt = new Date();
        this.updatedBy = updatedBy;
    }

}
